home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / othergnu / bc102s.zoo / makefile < prev    next >
Encoding:
Makefile  |  1992-06-20  |  5.9 KB  |  212 lines

  1. # NOTES: (rosenkra@convex.com)
  2. #    - used GNU C v1.40, MiNT libs PL 19, GNU make 3.60, bison v1.14,
  3. #      flex v2.3.7.
  4. #    - "bison -y -d" produces y_tab.c and y_tab.h on atari. these were
  5. #      changed here as was the #include "y.tab.h" in scan.l.
  6. #    - "flex" produces lexyy.c on atari (not lex.yy.c). changed here.
  7. #    - changed PREFIX, INCLUDE, YACC, LEX, MAKE macros
  8. #    - changed targets to make .ttp files
  9. #    - changed CC macro; added LD macro and used in .ttp targets
  10. #    - added CP macro and replaced all cp's with $(CP) (if your cp does
  11. #      not grok -p, change CP)
  12. #    - removed -D_POSIX_SOURCE from CFLAGS (not used anywhere anyway)
  13. #    - added LIBS macro and added to rules for targets
  14. #    - changed all *.dist files to ./dist/* instead (ie in directory)
  15. #-----------------------------------------------------------------------------
  16. # A makefile for bc.  This is part of the bc/sbc distribution.
  17. #
  18. #
  19. #  Make sure these have the correct directories for your machine.
  20. #
  21. #  LIBDIR and BINDIR are where bc and libmath.b will be put.
  22. #
  23. PREFIX = e:/local
  24. LIBDIR = $(PREFIX)/lib
  25. BINDIR = $(PREFIX)/bin
  26. MANDIR = $(PREFIX)/man/man1
  27. #
  28. #  INCLUDE is the directory from where header files are included.
  29. #
  30. INCLUDE = g:/mint/include
  31. #
  32. # This is the name of the library file, if needed.  This definition should
  33. # not be deleted.
  34. #
  35. LIBFILE = $(LIBDIR)/libmath.b
  36. #
  37. # Programs definitions for use by make.
  38. #
  39. SHELL = sh
  40. YACC = bison -y
  41. # i need the -S to force skeleton for flex. -I8 is original flag...
  42. LEX = flex -Sg:/gnu/gcc/flex.ske -I8
  43. CC = gcc -v -z -Wall -Ig:/mint/include
  44. LD = gcc -v -z -Wall -Lg:/mint/lib
  45. UUENCODE = uue
  46. MAKE = make360
  47. # this is GNU cp from futils. -p preserves timestamp
  48. CP = cp -p
  49. #
  50. #  The following are the standard definitions.  For MINIX PC, you need to
  51. #  comment these out and select one of the MINIX PC definition sets.
  52. #  Other configuration defines are generated automatically.  See the 
  53. #  README file for more details.
  54. #
  55. O=o
  56. #CFLAGS = -O -D_POSIX_SOURCE
  57. CFLAGS = -O
  58. LDFLAGS = -nostdlib g:/mint/lib/crt0.o
  59. #
  60. # For the PC version of MINIX (K&R compiler), use the following lines.
  61. #O=s
  62. #CFLAGS = -O -D_POSIX_SOURCE
  63. #LDFLAGS = -i
  64. #
  65. # For the PC version of MINIX (ANSI compiler), use the following lines:
  66. #O=o
  67. #CFLAGS = -m -D_POSIX_SOURCE
  68. #LDFLAGS = -i
  69. #
  70. # -nostdlib requires this (no -lflexlib was needed):
  71. LIBS = -lgnu
  72. #
  73. OFILES = scan.$O util.$O main.$O number.$O storage.$O load.$O execute.$O 
  74. #
  75. DISTFILES = COPYING Makefile Install bc.y bcdefs.h const.h version.h \
  76.             execute.c global.c global.h load.c main.c number.c storage.c \
  77.         number.h proto.h scan.l util.c vfprintf.c README bc.1 sbc.y \
  78.         fix_math.h math.h libmath.b configure ChangeLog 
  79. #
  80. SUBDIRS = examples test
  81. #
  82. EXTRAFILES = ./dist/bc.c ./dist/scan.c ./dist/y_tab.h
  83. #
  84.  
  85.  
  86. all: bc.ttp
  87.  
  88. bc.ttp: $& config.h bc.$O $(OFILES) global.$O
  89.     $(LD) -o bc.ttp $(LDFLAGS) bc.$O $(OFILES) global.$O $(LIBS)
  90.  
  91. sbc.ttp: sbc.$O $(OFILES) global.$O
  92.     $(LD) -o sbc.ttp $(LDFLAGS) sbc.$O $(OFILES) global.$O $(LIBS)
  93.  
  94. config.h:
  95.     ./configure $(INCLUDE) $(LIBFILE) $(CC)
  96.  
  97. math.h: libmath.b
  98.     $(MAKE) fbc.ttp
  99.     ./fbc -c libmath.b <u:/dev/null >math.h
  100.     ./fix_math.h
  101.     rm -f ./fbc
  102.  
  103. # this really needs to be built manually with on my system
  104. fbc.ttp: $(OFILES) bc.$O
  105.     echo \"\" > math.h
  106.     $(CC) -c $(CFLAGS) global.c
  107.     $(LD) -o fbc.ttp $(LDFLAGS) bc.$O $(OFILES) global.$O $(LIBS)
  108.  
  109. install : bc.ttp libmath.b config.h
  110.     rm -f $(BINDIR)/bc.ttp
  111.     $(CP) bc.ttp $(BINDIR)
  112.     chmod 555 $(BINDIR)/bc.ttp
  113.     if grep -s BC_MATH_FILE config.h; then rm -f $(LIBDIR)/libmath.b; \
  114.     $(CP) libmath.b $(LIBDIR); chmod 444 $(LIBDIR)/libmath.b; else true; fi
  115.     $(CP) bc.1 $(MANDIR)
  116.  
  117. dist: $(EXTRAFILES)
  118.     OF=`sed -n 's/.*\([0-9][0-9]*\.[0-9][0-9]*\).*/bc-\1/p' version.h` \
  119.     ; rm -rf $$OF \
  120.     ; mkdir $$OF \
  121.     ; cd $$OF \
  122.     ; for file in $(DISTFILES) $(EXTRAFILES); do ln ../$$file; done \
  123.     ; mkdir $(SUBDIRS) \
  124.     ; for dir in $(SUBDIRS); do $(CP) ../$$dir/* $$dir; done \
  125.     ; cd .. \
  126.     ; tar cf $$OF.tar $$OF \
  127.     ; compress $$OF.tar \
  128.     ; rm -rf $$OF
  129.  
  130. shars: dist
  131.     OF=`sed -n 's/.*\([0-9][0-9]*\.[0-9][0-9]*\).*/bc-\1/p' version.h` \
  132.     ; $(UUENCODE) $$OF.tar.Z - > $$OF.uue \
  133.     ; split -775 $$OF.uue $$OF-u. \
  134.     ; for file in $$OF-u.a?; do shar $$file > $$file.sh; done
  135.  
  136. minixdist: $(EXTRAFILES)
  137.     OF=`sed -n 's/.*\([0-9][0-9]*\.[0-9][0-9]*\).*/bc-\1/p' version.h` \
  138.     ; rm -rf $$OF \
  139.     ; mkdir $$OF \
  140.     ; cd $$OF \
  141.     ; for file in $(DISTFILES) $(EXTRAFILES); do ln ../$$file; done \
  142.     ; cd .. \
  143.     ; tar cf $$OF.tar $$OF \
  144.     ; compress -b13 $$OF.tar \
  145.     ; rm -rf $$OF
  146.  
  147. minixshars: minixdist
  148.     OF=`sed -n 's/.*\([0-9][0-9]*\.[0-9][0-9]*\).*/bc-\1/p' version.h` \
  149.     ; $(UUENCODE) $$OF.tar.Z - > $$OF.uue \
  150.     ; split -775 $$OF.uue $$OF-u. \
  151.     ; for file in $$OF-u.a?; do shar $$file > $$file.sh; done
  152.  
  153. csrshars: $(EXTRAFILES)
  154.     findsrc -dy $(DISTFILES) $(EXTRAFILES) $(SUBDIRS) | \
  155.     makekit -npart -oMANIFEST
  156.  
  157. ./dist/bc.c: bc.c
  158.     $(CP) bc.c ./dist/bc.c
  159.  
  160. ./dist/scan.c: scan.c
  161.     $(CP) scan.c ./dist/scan.c
  162.  
  163. ./dist/y_tab.h: y_tab.h
  164.     $(CP) y_tab.h ./dist/y_tab.h
  165.  
  166. extra:  $(EXTRAFILES)
  167.  
  168. # assumes that the extra files exist!
  169. derived:
  170.     $(CP) ./dist/bc.c bc.c
  171.     $(CP) ./dist/scan.c scan.c
  172.     $(CP) ./dist/y_tab.h y_tab.h
  173.  
  174. clean:
  175.     rm -f *.$O core ERRS *~ *.bak *.Z 
  176.  
  177. distclean: clean
  178.     rm -f scan.c y_tab.h bc.c sbc.c bc sbc bc-dist* config.h  bc-*.* \
  179.     part?? MANIFEST*
  180.  
  181. realclean: distclean
  182.     rm -rf *.dist
  183.  
  184. scan.c: scan.l
  185.     $(LEX) scan.l
  186.     mv lexyy.c scan.c
  187.  
  188. y_tab.h bc.c: bc.y
  189.     @echo "expect 1 shift/reduce conflict"
  190.     $(YACC) -d bc.y
  191.     mv y_tab.c bc.c
  192.  
  193. sbc.c: sbc.y
  194.     $(YACC) -d sbc.y
  195.     mv y_tab.c sbc.c
  196.  
  197. global.$O: bcdefs.h global.h math.h
  198. bc.$O:    bcdefs.h global.h 
  199. execute.$O: bcdefs.h global.h
  200. load.$O: bcdefs.h global.h 
  201. main.$O: bcdefs.h global.h version.h
  202. number.$O: bcdefs.h Makefile
  203. sbc.$O: bcdefs.h global.h 
  204. scan.$O: y_tab.h bcdefs.h global.h
  205. storage.$O: bcdefs.h global.h
  206. util.$O: bcdefs.h global.h version.h
  207.  
  208. bcdefs.h: number.h const.h config.h
  209.     touch bcdefs.h
  210.